package com.cff.common;

import java.awt.Panel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.JLabel;
import javax.swing.JTextField;

public class CacheMemory {
	public static int index = 0;
	public static List<JTextField> sktJTextField = new ArrayList<JTextField>();
	public static List<JLabel> sktJLabel = new ArrayList<JLabel>();
	public static Map<String,JTextField> sktMsg = new HashMap<String,JTextField>();
	public static Map<String,JTextField> sktMsg48 = new HashMap<String,JTextField>();
	public static int labelPos = 30;
	public static int textPos = 20;
	public static int label48Pos = 30;
	public static int text48Pos = 20;
	
	public static void makeNewMsg(Panel controlPanel,String labelName,String textName){
		if(index == 19){
			index = 0;
		}
		JLabel labelTmp = sktJLabel.get(index);
		
		JTextField textTmp = sktJTextField.get(index);
		labelTmp.setText(labelName);
		textTmp.setText(textName);
		labelTmp.setBounds(labelPos, 120, 90, 30);
		textTmp.setBounds(textPos, 160, 90, 30);
		labelPos += 110;
		textPos += 110;
//		controlPanel.add(labelTmp);
//		controlPanel.add(textTmp);
		sktMsg.put(labelName,textTmp);
		index++;
	}

	public static void makeNewMsg48(Panel controlPanel, String labelName, String textName) {
		if(index == 19){
			index = 0;
		}
		JLabel labelTmp = sktJLabel.get(index);
		
		JTextField textTmp = sktJTextField.get(index);
		labelTmp.setText(labelName);
		textTmp.setText(textName);
		labelTmp.setBounds(label48Pos, 370, 100, 30);
		textTmp.setBounds(text48Pos, 405, 100, 30);
		label48Pos += 120;
		text48Pos += 120;
//		controlPanel.add(labelTmp);
//		controlPanel.add(textTmp);
		sktMsg48.put(labelName,textTmp);
		index++;
	}
}
